<template>
  <view class="home">
    <!-- 头部 -->
    <view class="wz-top">
      <image src="/static/topbj.png" mode="" class="topbjs"></image>
      <view class="cont">
        <view class="c-itemsa">
          精彩瞬间
        </view>
      </view>
    </view>

    <!--搜索  -->
    <view class="splendid_search">
      <!-- <u-search :show-action="false" @focus='goSearch()'></u-search> -->
      <view class="search" @click='goSearch()'>
        <u-icon name="search" size="30"></u-icon>
        <view class="tt">
          请输入关键词
        </view>
      </view>

      <view class="sort">
        <view :class="flag ? 'active' : ''" @click="flag=true">视频集
          <image v-if="flag" class="line1" src="../../static/imgs/Ellipse143.png" mode=""></image>
        </view>
        <view :class="flag ? '' : 'active'" @click="flag=false">图文集
          <image v-if="flag==false" class="line1" src="../../static/imgs/Ellipse143.png" mode=""></image>
        </view>
      </view>
    </view>

    <!-- 内容:视频集 -->
    <u-waterfall v-model="flowList" v-if="flag">
      <template v-slot:left="{leftList}">
        <view v-for="(item, index) in 5" :key="index" class="leftList" @click="govideo()">
          <div class="img" style="height: 268rpx;">
            <image src="https://img0.baidu.com/it/u=3544561646,456831003&fm=253&fmt=auto&app=120&f=JPEG?w=1280&h=800"
              mode=""></image>
            <div class="tags">
              <image src="../../static/imgs/Slice 85@2x.png" mode=""></image>
              <!-- <u-icon name="play-right-fill" color="white" size='20'></u-icon> -->
            </div>
          </div>
          <view class="content">
            长清大学生红叶谷汉服真人秀
          </view>
          <view class="time">
            <text>发布时间：2023-3-12</text>
          </view>
        </view>
      </template>
      <template v-slot:right="{rightList}">
        <view v-for="(item, index) in 3" :key="index" class="rightList" @click="govideo()">
          <div class="img" style="height: 268rpx;">
            <image src="https://img0.baidu.com/it/u=3544561646,456831003&fm=253&fmt=auto&app=120&f=JPEG?w=1280&h=800"
              mode=""></image>
            <div class="tags">
              <image src="../../static/imgs/Slice 85@2x.png" mode=""></image>
              <!-- <u-icon name="play-right-fill" color="white" size='20'></u-icon> -->
            </div>
          </div>
          <view class="content">
            长清大学生红叶谷汉服真人秀
          </view>
          <view class="time">
            <text>发布时间：2023-3-12</text>
          </view>
        </view>
      </template>
    </u-waterfall>

    <!-- 图文集 -->
    <u-waterfall v-model="flowList" v-else>
      <template v-slot:left="{leftList}">
        <view v-for="(item, index) in 3" :key="index" class="leftList" @click="gotext()">
          <!-- 这里编写您的内容，item为您传递给v-model的数组元素 -->
          <view class="img" style="width: 268rpx; ">
            <image src="https://img1.baidu.com/it/u=3045548345,351215258&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=1093"
              mode="widthFix"></image>

          </view>
          <view class="content">
            长清大学生红叶谷汉服真人秀
          </view>
          <view class="jieshao">
            非常满意的一次旅行
          </view>
          <view class="time">
            <text>发布时间：2023-3-12</text>
          </view>
          <view class="chakan">
            <u-icon name="eye-fill" color="#999" style="vertical-align: middle;" size='32'></u-icon>
            <text>1238</text>
          </view>
        </view>
      </template>

      <template v-slot:right="{rightList}">
        <view v-for="(item, index) in 3" :key="index" class="rightList" @click="gotext()">
          <!-- 这里编写您的内容，item为您传递给v-model的数组元素 -->
          <view class="img" style="width: 268rpx;">
            <image
              src="https://img1.baidu.com/it/u=1890390320,3399874998&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1695488400&t=4d4a9bbf5b995b8fff02ed69611cab69"
              mode="widthFix"></image>
          </view>
          <view class="content">
            长清大学生红叶谷汉服真人秀
          </view>
          <view class="jieshao">
            非常满意的一次旅行，行程后面两天自主报了几...
          </view>
          <view class="time">
            <text>发布时间：2023-3-12</text>
          </view>

          <view class="chakan">
            <u-icon name="eye-fill" color="#999" style="vertical-align: middle;" size='32'></u-icon>
            <text>1238</text>
          </view>
        </view>
      </template>
    </u-waterfall>


  </view>
</template>

<script>
  export default {
    data() {
      return {
        keyword: '', // 搜索框输入
        flag: true, // 切换
        rightList: []
      }
    },
    methods: {
      govideo() {
        uni.navigateTo({
          url: '../../pages/splendid/video_details'
        })
      },
      gotext() {
        uni.navigateTo({
          url: '/pages/splendid/text_details'
        })
      },
      goSearch() {
        uni.navigateTo({
          url: '/pages/search/search'
        })
      }
    }
  }
</script>

<style scoped lang="scss">
  .home {
    padding-bottom: 80rpx;
    background: #F5F5F5;


    .wz-top {
      background-color: #5bcce7;
      height: 180rpx;
      color: #333;
      position: relative;
      z-index: 1;

      .topbjs {
        width: 100%;
        height: 452rpx;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
      }

      .cont {
        padding: 0 20rpx;
        display: flex;
        position: relative;
        z-index: 2;

        .c-itemsa {
          line-height: 270rpx;
          width: 100%;
          display: flex;
          justify-content: center;
          font-size: 32rpx;
          font-family: PingFang SC-Bold, PingFang SC;
          font-weight: bold;
          color: #333333;
        }

      }

    }
  }

  // 搜索
  .splendid_search {
    margin: 50rpx 32rpx;
    padding: 32rpx;
    position: relative;
    z-index: 2;
    // width: 686rpx;
    height: 202rpx;
    background: #FFFFFF;
    box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(102, 102, 102, 0.1);
    border-radius: 20rpx 20rpx 20rpx 20rpx;

    .sort {

      margin-top: 35rpx;
      display: flex;
      justify-content: space-around;
      font-size: 28rpx;

      .active {
        font-size: 28rpx;
        font-weight: bold;
        color: #FAD74E;
        position: relative;
        display: inline-block;

        .line1 {
          position: absolute;
          left: 30%;
          bottom: -15rpx;
          width: 38rpx;
          height: 8rpx;
        }
      }
    }
  }

  // 内容
  .leftList,
  .rightList {
    margin-bottom: 20rpx;
    padding: 30rpx;
    width: 332rpx;
    // height: 332rpx;
    background: #FFFFFF;
    box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(102, 102, 102, 0.1);
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .leftList {
    margin-left: 32rpx;
  }

  .rightList {
    margin-right: 32rpx;
  }

  .leftList,
  .rightList {

    .img {
      width: 268rpx;
      // height: 151rpx;
      height: auto;
      // min-height: 150rpx;
      // max-height: 268rpx;
      border-radius: 8rpx 8rpx 8rpx 8rpx;
      overflow: hidden;
      position: relative;


      >image {

        // min-height: 150rpx;
        // max-height: 268rpx;
        border-radius: 8rpx 8rpx 8rpx 8rpx;
        width: 100%;
        // height: auto;
      }



      .tags {
        width: 52rpx;
        height: 52rpx;
        background: rgba(250, 201, 22, 0.8);

        position: absolute;
        left: 40%;
        top: 40%;
        display: flex;
        font-size: 14rpx;
        align-items: center;
        border-radius: 50%;
        justify-content: center;

        >image {
          width: 52rpx;
          height: 52rpx;
        }
      }
    }

    .content {
      margin: 18rpx 0 20rpx;
      font-size: 24rpx;
      font-weight: bold;
      color: #333333;
    }

    .time {
      margin-bottom: 15rpx;
      font-size: 24rpx;
      font-weight: 500;
      color: #999;
    }

    // 
    .jieshao {
      margin-bottom: 20rpx;
      font-size: 24rpx;
      font-weight: 500;
      color: #666666;
    }

    .chakan {
      text-align: right;

      >text {
        margin-left: 10rpx;
        font-size: 20rpx;
        font-weight: 500;
        color: #999999;
      }
    }
  }




  .rightList {
    margin-left: 22rpx;
  }

  .search {
    width: 622rpx;
    height: 62rpx;
    background: #F2F2F2;
    border-radius: 74rpx 74rpx 74rpx 74rpx;
    display: flex;
    align-items: center;
    color: #949494;
    font-size: 24rpx;
    padding-left: 40rpx;

    .tt {
      margin-left: 10rpx;
    }
  }
</style>